/* eslint valid-jsdoc: "off" */

"use strict"
const path = require("path")

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  const config = (exports = {})

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + "_1567345288529_9121"

  // add your middleware config here
  config.middleware = []

  // mysql配置文件
  config.mysql = {
    client: {
      // host
      host: "106.15.232.209",
      // 端口号
      port: "3306",
      // 用户名
      user: "root",
      // 密码
      password: "Lsj@890305",
      // 数据库名
      database: "zan"
    }
  }
  // add your user config here
  const userConfig = {
    token: "c0fa2a2cf26c4ec42faae0cf53030a64",
    Cookie:
      "FENDDSSID=%7B%22account%22%3A%2215618536609%22%2C%22token%22%3A%22c0fa2a2cf26c4ec42faae0cf53030a64%22%2C%22time%22%3A1567426894%2C%22sign%22%3A%22e76df8084bba85e2078f5f1d97f8d29e%22%7D; PHPSESSID=snpm2e7bl4enbhemh0kdvbk560",
    userAgent:
      "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1"
  }

  config.security = {
    csrf: false
  }

  config.static = {
    dir: [
      { dir: path.join(appInfo.baseDir, 'app/public'), prefix: '/public/' }, // 前端项目构建目录
      { dir: path.join(appInfo.baseDir, 'upload'), prefix: '/upload/' }, // 用户上传图片目录
    ], // 多静态文件入口
  };
  config.view = {
    defaultViewEngine: "nunjucks",
    mapping: {
      ".html": "nunjucks"
    }
  }

  return {
    ...config,
    ...userConfig
  }
}
